Draft
Conversation
…atting to tool result rendering
…ing-llm into feat-background-jobs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Pull Request Type
Relevant Issues
resolves #5349
Description
Adds Scheduled Jobs — recurring AI tasks that run prompts with optional agent tools on a cron schedule (single-user mode only).
Users can create jobs with a name, prompt, cron schedule, and optional tool selection from all configured agent skills (built-in, MCP servers, agent flows, imported plugins). Jobs run automatically via cron timers, and each execution captures a full trace — agent thinking, tool calls with their results, and the final response.
Key capabilities:
SCHEDULED_JOB_MAX_CONCURRENT, default 1) and timeout (SCHEDULED_JOB_TIMEOUT_MS, default 5 min)Architecture:
later.setIntervalrather than Bree's built-in scheduling because Bree tightly couples scheduling with worker spawning — when a Bree cron fires it directly spawns a child process with no way to intercept. By owning the timers we can route executions through ap-queueinstance for concurrency control, deduplication, and priority ordering before spawning workers viarunJob().EphemeralAgentHandler— same proven agent runtime as the Telegram bottoolCallResultevent on AIbitat for capturing tool outputs in the execution tracetoolOverridesparam onEphemeralAgentHandler.createAIbitat()for per-job tool restrictionRoute protection:
SingleUserRoutewrapper inPrivateRoute/index.jsx— redirects to home if in multi-user mode, similar to howAdminRouteandManagerRoutehandle RBAC. This keeps the single-user-only restriction at the route level viamain.jsxso individual page components don't need to duplicate auth/redirect logic. Server-side enforcement is handled by the existingisSingleUserModemiddleware on all scheduled job endpoints.Frontend structure:
ScheduledJobs/index.jsx— job list with CRUD, toggle, triggerScheduledJobs/RunHistoryPage.jsx— run history table for a jobScheduledJobs/RunDetailPage.jsx— full run detail with trace viewerScheduledJobs/NewJobModal.jsx— create/edit modalScheduledJobs/utils/cron.js— shared cron presets andcronToHumanhelperAdditional Information
BackgroundService/Bree infrastructureDemo of Job Creation, Job Run Inspection and Forwarding Job Run to New Thread
output.mp4
Demo of Job Completion Push Notification
trimmed_demo.mp4
Development
This PR contains new DB migrations, make sure to run
yarn prisma migrate devbefore testing the feature.Developer Validations
yarn lintfrom the root of the repo & committed changes